package com.yonyou.cyxdms.sysmanage.client.service.login;

import com.yonyou.cyx.framework.util.bean.ApplicationContextHelper;
import com.yonyou.cyx.function.utils.common.StringUtils;
import com.yonyou.cyxdms.framework.bean.dto.push.PushDTO;
import com.yonyou.cyxdms.framework.bean.dto.user_info.LoginInfoDto;
import com.yonyou.cyxdms.sysmanage.client.domains.dto.JPushDTO;
import com.yonyou.cyxdms.sysmanage.client.domains.dto.PushMsgDTO;
import com.yonyou.cyxdms.sysmanage.client.domains.dto.SmsPushDTO;
import com.yonyou.cyxdms.sysmanage.client.feign.F4PushService;
import com.yonyou.cyxdms.sysmanage.client.feign.SysmanageDataCommonClient;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by adu on 2019/10/24.
 * 通过其两个属性name以及havingValue来实现的，其中name用来从application.properties中读取某个属性值。
 * 如果该值为空，则返回false;
 * 如果值不为空，则将该值与havingValue指定的值进行比较，如果一样则返回true;否则返回false。
 * 如果返回值为false，则该configuration不生效；为true则生效。
 */
@Service
@ConditionalOnProperty(prefix = "pushx", name = "config", havingValue = "true", matchIfMissing = true)
public class PushServicesImpl implements PushServices {

    @Autowired
    F4PushService f4PushService;

    @Autowired
    SysmanageDataCommonClient SysmanageDataCommonClient;

    @Override
    public String apps(JPushDTO jPushDTO,String appId) {
        return f4PushService.apps(jPushDTO,appId);
    }

    @Override
    public String sendSms(SmsPushDTO smsPushDTO) {
        return f4PushService.sendSms(smsPushDTO);
    }

    /**
     * 推送
     *
     * @param pushMsgDTO
     * @return String
     * @author maxingjian
     * @date 2019年12月24日
     */
    @Override
    public void pushMsg(PushMsgDTO pushMsgDTO) {
        SysmanageDataCommonClient.pushMsg(pushMsgDTO).getData();
    }


}
